package com.lizi.MarkHsiu;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lizi.core.util.FilesTools;

public class JSONFIle {

	public static void main(String[] args) {
		
		System.out.println(JSON.toJSONString(null));
		String json = FilesTools.getJsonEntry("data.json");
		JSONArray array = JSON.parseArray(json);
		
		System.out.print("店铺");
		System.out.print(",");
		System.out.print("商品名称");
		System.out.print(",");
		System.out.print("商品ID");
		System.out.print(",");
		System.out.print("SKU修改时间");
		System.out.print(",");
		System.out.print("SKUID");
		System.out.print(",");
		System.out.print("SKU名称");
		System.out.print(",");
		System.out.print("SKU状态");
		System.out.print(",");
		System.out.print("SKU价格");
		System.out.print(",");
		System.out.print("SKU编码");
		System.out.print(",");
		System.out.print("SKU库存");
		System.out.println();
		for (int i = 0; i < array.size(); i++) {
			JSONObject obj = array.getJSONObject(i);
			
			System.out.print(obj.get("storeName"));
			System.out.print(",");
			System.out.print(obj.get("title"));
			System.out.print(",");
			System.out.print(obj.get("itemNum"));
			System.out.print(",");
			System.out.print(obj.get("lastUpdated"));
			System.out.print(",");
			System.out.print(obj.get("skuId"));
			System.out.print(",");
			System.out.print(obj.get("specification"));
			System.out.print(",");
			System.out.print(obj.getIntValue("status") == 0? "删除":"正常使用");
			System.out.print(",");
			System.out.print(obj.get("price"));
			System.out.print(",");
			System.out.print(obj.get("code"));
			System.out.print(",");
			System.out.print(obj.get("storage"));
			System.out.println();
			
		}
	}
	
}
